<?php
/**
 * Created by PhpStorm.
 * User: linhongzhao
 * Date: 18-5-12
 * Time: 上午11:15
 */
require_once __DIR__ . '/../src/Random.php';

echo 'defined options:' . PHP_EOL;
Random::options();
echo PHP_EOL;

echo '########' . PHP_EOL;
$start = microtime(true);
$rand_str = Random::string();
$spend = microtime(true) - $start;
echo '- string: ' . $rand_str . PHP_EOL;
echo '- length: ' . strlen($rand_str) . PHP_EOL;
echo '- spend time: ' . $spend . PHP_EOL;

echo '########' . PHP_EOL;
$start = microtime(true);
$rand_str = Random::string(1000, CHARS_ALL);
$spend = microtime(true) - $start;
echo '- string: ' . $rand_str . PHP_EOL;
echo '- length: ' . strlen($rand_str) . PHP_EOL;
echo '- spend time: ' . $spend . PHP_EOL;

echo PHP_EOL;
$start = time();
$count = 0;
while (!(time() - $start)) {
    Random::string(256, CHARS_ALL);
    $count++;
}
echo 'It\'s length of 256 for string, About ' . $count . ' are generated per second.' . PHP_EOL;
echo 'NOTE: You should run a few more times to determine the general range' . PHP_EOL;